<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <title>商城-主页</title>
    <link rel="stylesheet" type="text/css" th:href="@{/static/layui-v2.6.13/layui/css/layui.css}"/>
    <script type="text/javascript" th:src="@{/static/js/jquery-1.9.1.min.js}"></script>
    <script type="text/javascript" th:src="@{/static/layui-v2.6.13/layui/layui.js}"></script>
</head>
<body style="margin: 0; padding: 0;" class="layui-bg-gray">
<div class="layui-container" style="width: 100%; margin: 0; padding: 0;">
    <div class="layui-row" style="height: 40px;background-color: gainsboro;">
        <p class="layui-col-md3 " style="font-size:20px;margin-top:5px" align="center">
            <i class="layui-icon" style="font-size:20px;">&#xe698;</i>购物商城</p>
        <div class="layui-col-md6 ">
            <div class="layui-inline">
                <a class="layui-btn layui-btn-normal layui-inline" target="main" th:href="@{/shopping/homepage}">首页</a>
            </div>
        </div>
        <div class="layui-col-md3 ">
            <span onclick="gwc()" class="layui-btn layui-btn-normal">购物车</span>
            <span onclick="dd()" class="layui-btn layui-btn-normal">我的订单</span>
            <span th:text="'用户:'+${username}" class="layui-btn layui-btn-normal"></span>
        </div>
    </div>
    <div class="layui-col-md12">
    <iframe th:src="@{/shopping/homepage}" id="main" name="main" style="width:100%; height:700px;"></iframe>
    </div>
</div>
</body>
<script th:inline="javascript">
    function dd(){
        if([[${user.phone}]]==null){
            alert("请先登录");
        }
        else{
            var iframe = document.getElementById("main");
            var iwindow = iframe.contentWindow;
            iwindow.location.href='/shop/order/all?userId='+[[${session.userid}]];
        }
    }
    function gwc(){
        if([[${user.phone}]]==null){
            alert("请先登录");
        }
        else{
            var iframe = document.getElementById("main");
            var iwindow = iframe.contentWindow;
            iwindow.location.href='/shop/cart/myCart?userId='+[[${session.userid}]];
        }
    }

</script>
</html>